<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div id="app">
    <h2>{{fullName0}}</h2>
    <h2>{{fullName1}}</h2>
    <h2>{{fullName2}}</h2>
</div>


<script src="../../js/vue.js"></script>

<script>
    const vue = new Vue({
        el: "#app",
        data: {
            firstName: "Deng",
            lastName: "jian"
        },
        computed: {
            fullName0: function () {
                return this.firstName + ' ' + this.lastName;
            },
            // 计算属性一般不给set方法，是个只读属性，因此，fullName0为最终版本
            fullName1: {
                set: function () {},
                get: function () {
                    return this.firstName + ' ' + this.lastName;
                }
            },
            fullName2() {
                return this.firstName + ' ' + this.lastName;
            }
        }
    });
</script>

</body>
</html>